<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Agent 24</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=7" />
        <link rel="shortcut icon" href="#" type="image/x-icon" />
        <meta name="keywords" content="" />
        <meta name="description" content="" />
        <meta name="author" content="" />
        <meta name="robots" content="index,follow" />
        <link href="<?php echo CSSPATH; ?>default.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
        <script src="<?php echo JSPATH; ?>scripts.js" type="text/javascript"></script>
        <script src="<?php echo JSPATH; ?>background-change.js" type="text/javascript"></script>
        <script type="text/javascript">
            function postLanguage(id) {
                document.getElementById("langForm").language_id.value = id;
                document.langForm.submit();
                /*
                $.ajax({  
                  type: "POST",
                  url: "<?php echo site_url(); ?>",
                  data: "language_id=" + id
                });
                */
            }
        </script>
        <script type="text/javascript">
            function postMenu(id) {
                //$.post("<?php echo site_url(); ?>", { menu_id : id });
                $.ajax({  
                  type: "POST",
                  url: "<?php echo site_url(); ?>",
                  dataType: "json",
                  data: {menu_id: id},
                    success: function(data) {
                        $('#ac_background .ac_bgimage').each(function(){$(this).remove();});
                        $('#ac_background').append('<img class="ac_bgimage" src="<?php echo FILEPATH; ?>/bg/'+data[0].url+'" />');
                        $('.ac_menu').html('');
                        for(var  i=0; i<3; i++){
                            var picUrl = "<?php echo FILEPATH; ?>"+'bg/'+data[i].url;
                            $('.ac_menu').append('<li><a href="'+picUrl+'"></a></li>')
                        }
                        delete Menu;
                        Menu = getMenu();
                        Menu.init();
                    }
                });
            }
        </script>        
    </head>
    <body>
        <!-- background change -->
        <div id="ac_background" class="ac_background">
            <img class="ac_bgimage" src="<?php echo FILEPATH . '/bg/'; if (!empty($multimedia)) { if (count($multimedia) > 1) { $index = array_rand($multimedia); echo $multimedia[0]['url']; } else { echo $multimedia[0]['url']; } } else { echo "/1.jpg"; } ?>" alt="Background"/>
            <div class="ac_overlay"></div>
            <div class="ac_loading"></div>
        </div>
        <!-- end background change -->
        <ul class="ac_menu">
            <?php
                if (!empty($multimedia)) {
                    foreach ($multimedia as $key => $image) {
            ?>
                        <li><a href="<?php echo FILEPATH . '/bg/' . $image['url'] ?>"></a></li>
            <?php
                    }
                } else {
            ?>
                    <li><a href="<?php echo FILEPATH . '/bg/1.jpg' ?>"></a></li>
            <?php
                }
            ?>
        </ul>
        <div class="headerW">
        <div class="header">
        <ul class="mainNav">
            <?php
                if (!empty($root[0]['menu'])) {
            ?>
                   
                        
                            <?php
                                foreach ($root as $key => $option) {
                                    if(!empty($option['content'])) {
                            ?>
                                        <li><a href="#<?php echo "/index.php/content/content_controller/view/" . $option['menu']['menu_id'] . "/" . $language_id; ?>" rel="content" onclick="postMenu('<?php echo $option['menu']['menu_id']; ?>')"><?php echo $option['menu']['title']; ?></a></li>
                            <?php
                                    } else {
                                        if($option['menu']['leafs']) {
                            ?>
                                        <li><a href="#" rel="submenu<?php echo $option['menu']['menu_id']; ?>" onclick="postMenu('<?php echo $option['menu']['menu_id']; ?>')"><?php echo $option['menu']['title']; ?></a></li>
                            <?php
                                        }
                                    }
                                }
                            ?>

                    
            <?php
                }
            ?>
                            <li><a class="selectLang" href="#" id="selectLanguage"><?php echo $language['name']; ?></a></li>
                        </ul>
        <div class="lang" id="languageMenu">
            <form id="langForm" name="langForm" method="POST" action="<?php echo site_url() . "/main"; ?>">
            <a href="#" class="close" id="closeLanguage"></a>
            <input type="hidden" name="language_id" />
                <ul>
                    <li><a href="#" onclick="return postLanguage('<?php echo $language['language_id']; ?>')"><?php echo $language['name']; ?></a></li>
                    <?php
                        if(!empty($languages)) {
                            foreach ($languages as $key => $language) {
                    ?>
                                <li><a href="#" onclick="return postLanguage('<?php echo $language['language_id']; ?>')"><?php echo $language['name']; ?></a></li>
                    <?php
                            }
                        }
                    ?>
                </ul>
            </form>
        </div>
                 </div>
        </div>

        <div class="hidden">
        <?php
        if (!empty($root[0]['menu'])) {
            if (!empty($leaf[0]['menu'])) {
                foreach ($root as $key => $roption) {
                        if($roption['menu']['leafs']) {
                    ?>
                    <!--<div class="hidden">-->
                        <ul id="<?php echo "submenu" . $roption['menu']['menu_id']; ?>">
                            <?php
                                foreach ($leaf as $key => $loption) {
                                    if($loption['menu']['parent_menu_id'] == $roption['menu']['menu_id'])
                                    if(!empty($loption['content'])) {
                            ?>
                                        <li><a href="#<?php echo "/index.php/content/content_controller/view/" . $loption['menu']['menu_id'] . "/" . $language_id; ?>" onclick="postMenu('<?php echo $loption['menu']['menu_id']; ?>')"><?php echo $loption['menu']['title']; ?></a></li>
                            <?php
                                    } else {
                            ?>
                                        <!-- css je vezan za a href -->
                                        <li><?php echo $loption['menu']['title']; ?></li>
                            <?php
                                    }
                                }
                            ?>
                                    
                        </ul>
                    <!--</div>-->
                    <?php
                    }
                }
            }
        }
        ?>
        </div>
        
        <a class="logo" href="/">
            <img width="210" height="40" src="<?php echo IMAGEPATH . "logo.png" ?>" alt="agent24" />
        </a>
        <a href="#" class="menuHide up"></a>
        <div class="footer">
            <ul>
                <li>Copyright 2011. &copy; Agent 24</li>
            </ul>
        </div>



        <ul class="imageRotate">
            <li><a href="#" class="left"></a></li>
            <li><a href="#" class="right"></a></li>
        </ul>
        <div class="page">
            <div class="subNav">
                <ul>
                </ul>
            </div>
            <div class="pageContent">
                <h2>Title</h2>
                <p>
                    Nam vulputate cursus ornare. Maecenas nisi nisl, congue eget semper et, sagittis vel dolor. Vestibulum semper suscipit cursus. Donec consequat nisi non mi commodo eu hendrerit justo commodo. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce malesuada aliquet hendrerit. Nullam non ipsum enim, quis viverra quam. Donec aliquet nibh at sem luctus sit amet venenatis risus lacinia. Nunc et erat id sapien commodo accumsan. Fusce viverra arcu ut tellus molestie et tincidunt metus vestibulum. Suspendisse vitae lacus metus. 
                </p>
            </div>
        </div>


    </body>
</html>
